﻿<Serializable()> _
Public Class clsSubGroup

    Private c_Name As String
    Private c_IsExpanded As Boolean
    Private c_IsSelected As Boolean
    Private c_Instruments As List(Of clsInstrument)

    Public Property Name() As String
        Get
            Return c_Name
        End Get
        Set(ByVal value As String)
            c_Name = value
        End Set
    End Property
    Public Property IsExpanded() As Boolean
        Get
            Return c_IsExpanded
        End Get
        Set(ByVal value As Boolean)
            c_IsExpanded = value
        End Set
    End Property
    Public Property IsSelected() As Boolean
        Get
            Return c_IsSelected
        End Get
        Set(ByVal value As Boolean)
            c_IsSelected = value
        End Set
    End Property
    Public Property Instruments() As List(Of clsInstrument)
        Get
            Return c_Instruments
        End Get
        Set(ByVal value As List(Of clsInstrument))
            c_Instruments = value
        End Set
    End Property

    Public ReadOnly Property SelectedInstrument() As Int32
        Get
            Dim idxSelected As Int32 = -1
            For idx = 0 To c_Instruments.Count - 1
                If c_Instruments(idx).IsSelected Then
                    idxSelected = idx
                    Exit For
                End If
            Next
        End Get
    End Property

End Class
